<?php 
namespace Common\Model;
use Common\Model\BaseModel;
/**
 *  闲言碎语model
 */
class ChatModel extends BaseModel
{
//	传递$map获取count数据
	public function getCountData($map=array()){
	    return $this->where($map)->count();
	}
	
	// 传递is_delete和is_show获取对应数据
    public function getDataByState($is_delete='all',$is_show='all'){
        $is_delete=$is_delete==='all' ? '' : "is_delete=$is_delete";
        $is_show=$is_show==='all' ? '' : "is_show=$is_show";
        $where=trim(trim($is_delete.' and '.$is_show,' '),'and');
        return $this->where($where)->order('date desc')->select();
    }
	
	
}
